package com.jch.helloworld.configBeans;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestAttrValBeanMain {

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("/beans/AttrValBeans.xml");
        System.out.println("attrValBean0：(构造器注入，带有特殊字符)");
        AttrValBean attrValBean0 = (AttrValBean) ctx.getBean("attrValBean0");
        System.out.println(attrValBean0);
        System.out.println("attrValBean1：(setter方法注入，带有特殊字符)");
        AttrValBean attrValBean1 = (AttrValBean) ctx.getBean("attrValBean1");
        System.out.println(attrValBean1);
        System.out.println("attrValBean2：(引用其他bean)");
        AttrValBean attrValBean2 = (AttrValBean) ctx.getBean("attrValBean2");
        System.out.println(attrValBean2);
        System.out.println("attrValBean3：(使用内部bean)");
        AttrValBean attrValBean3 = (AttrValBean) ctx.getBean("attrValBean3");
        System.out.println(attrValBean3);
        System.out.println("attrValBean4：(使用<null/>和级联注入)");
        AttrValBean attrValBean4 = (AttrValBean) ctx.getBean("attrValBean4");
        System.out.println(attrValBean4);
        System.out.println("attrValBean5：(注入list属性)");
        AttrValBean attrValBean5 = (AttrValBean) ctx.getBean("attrValBean5");
        System.out.println(attrValBean5);
        System.out.println("attrValBean6：(注入map属性)");
        AttrValBean attrValBean6 = (AttrValBean) ctx.getBean("attrValBean6");
        System.out.println(attrValBean6);
        System.out.println("attrValBean7：(注入数组属性)");
        AttrValBean attrValBean7 = (AttrValBean) ctx.getBean("attrValBean7");
        System.out.println(attrValBean7);
        System.out.println("testPropsBean：(Properties信息注入)");
        TestPropsBean propsBean = (TestPropsBean) ctx.getBean("testPropsBean");
        System.out.println(propsBean);
        System.out.println("attrValBeanList：(获取共享list信息)");
        AttrValBeanList attrValBeanList = (AttrValBeanList) ctx.getBean("oList");
        System.out.println(attrValBeanList);
        System.out.println("attrValBean8：(使用p命名空间配置bean属性)");
        AttrValBean attrValBean8 = (AttrValBean) ctx.getBean("attrValBean8");
        System.out.println(attrValBean8);
    }

}
